# -*- coding: utf-8 -*-
# author yzs
# date 2019-01-01
#
# 非递归合并排序
# Description
# 合并(归并)排序的核心思想是:每次从中间位置将数组分组再分别排序。请实现其非递归方案。
# Input
# 输入的每一行表示一个元素为正整数的数组，所有值用空格隔开，第一个值为数值长度，其余为数组元素值
# Output
# 输出每一行为排序结果，用空格隔开，末尾不要空格
# Sample Input 1
# 13 24 3 56 34 3 78 12 29 49 84 51 9 100
# Sample Output 1
# 3 3 9 12 24 29 34 49 51 56 78 84 100


def merge(data, low, mid, height):
    left = data[low:mid]
    right = data[mid:height]
    m = 0
    n = 0
    result = []
    while m < len(left) and n < len(right):
        if left[m] <= right[n]:
            result.append(left[m])
            m += 1
        else:
            result.append(right[n])
            n += 1
    result += left[m:]
    result += right[n:]
    data[low:height] = result


def merge_sort(data):
    i = 1
    while i < len(data):
        low = 0
        while low < len(data):
            mid = low + i
            height = min(low + 2 * i, len(data))
            if mid < height:
                merge(data, low, mid, height)
            low += 2 * i
        i *= 2


while True:
    try:
        data = list(map(int, input().strip().split()))
        num, data = data[0], data[1:data[0] + 1]
        merge_sort(data)
        print(" ".join(str(i) for i in data))
    except EOFError:
        break
